﻿using Ducu.BLL.Entity;
using Ducu.SRV.ServiceInteface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Global.Core.ExtensionMethod;

namespace Ducu.SRV.ProdService
{
    public class PasswordService : BaseService, IPasswordService
    {
        public void Reset(int id, string password)
        {
            User user = repoFactory.Load<User>(id);
            user.RegisterInfo.Password = password.Md5Encypt();
        }


        public bool IsCorrect(string password)
        {
            return getCurrentUser().RegisterInfo.Password == password.Md5Encypt();
        }

        public void Change(string password)
        {
            getCurrentUser().RegisterInfo.Password = password.Md5Encypt();
        }
    }
}
